import axios from '@/utils/request';

/**
 * 新增客户档案
 */
export async function AddCustomer(params) {
    const res = await axios.post('/Customer/AddCustomer',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 获取客户档案查询分页列表
 */
 export async function QueryCustomerPageList(params) {
    const res = await axios.post('/Customer/QueryCustomerPageList',params);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 根据id获取客户档案
 */
 export async function GetCustomerById(id) {
    const res = await axios.get('/Customer/GetModelById/'+id);
    if (res.data.code === 200) {
        return res.data.data;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 更新客户档案
 */
 export async function UpdateCustomer(params) {
    const res = await axios.post('/Customer/UpdateCustomer',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}

/**
 * 删除客户
 */
 export async function DeleteCustomer(id) {
    const res = await axios.post('/Customer/DeleteCustomer?id='+id);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
}



 /**
  * 修改客户状态信息
  */
 export async function UpdateStatus(params) {
    const res = await axios.post('/Customer/UpdateStatus',params);
    if (res.data.code === 200) {
        return res.data.msg;
    }
    return Promise.reject(new Error(res.data.msg));
  }